﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using MySql.Data.MySqlClient;

namespace WaveMaster.Holidays.Club.Domain
{
    public class TicketPurchase
    {
        string m_code;
        DateTime m_transactionDate;
        long m_purchaseID;
        TravelAgent m_travelAgent;
        decimal m_quantity;
        decimal m_unitPrice;
        decimal m_totalPrice;
        decimal m_discount;
        TicketType m_ticketType;
        DateTime m_cretnDate;
        long m_cretnBy = 0;
        DateTime m_modfctnDate;
        long m_modfctnBy;

        public TicketPurchase() { }
        public TicketPurchase(long id)
        {

        }
        public TicketPurchase(MySqlDataReader rd)
        {
            m_code = rd["m_code"].ToString();
            m_transactionDate = Convert.ToDateTime(rd["m_transactionDate"]);
            m_purchaseID = Convert.ToInt64(rd["m_purchaseID"]);
            m_travelAgent = new TravelAgent(Convert.ToInt64(rd["m_travelAgentId"]));
            m_quantity = Convert.ToDecimal(rd["m_quantity"]);
            m_unitPrice = Convert.ToDecimal(rd["m_unitPrice"]);
            m_totalPrice = Convert.ToDecimal(rd["m_totalPrice"]);
            m_discount = Convert.ToDecimal(rd["m_discount"]);
            m_ticketType = (TicketType)Enum.Parse(typeof(TicketType), rd["m_ticketType"].ToString());
            m_cretnDate = Convert.ToDateTime(rd["m_cretnDate"]);
            m_cretnBy = Convert.ToInt64(rd["m_cretnBy"]);
            m_modfctnDate = Convert.ToDateTime(rd["m_modfctnDate"]);
            m_modfctnBy = Convert.ToInt64(rd["m_modfctnBy"]);
        }
        public string Code
        {
            get { return m_code; }
            set { m_code = value; }
        }
        public TicketType TicketType
        {
            get { return m_ticketType; }
            set { m_ticketType = value; }
        }
        public DateTime TransactionDate
        {
            get { return m_transactionDate; }
            set { m_transactionDate = value; }
        }
        public long PurchaseID
        {
            get { return m_purchaseID; }
            set { m_purchaseID = value; }
        }
        public TravelAgent TravelAgent
        {
            get { return m_travelAgent; }
            set { m_travelAgent = value; }
        }
        public decimal Quantity
        {
            get { return m_quantity; }
            set { m_quantity = value; }
        }
        public decimal UnitPrice
        {
            get { return m_unitPrice; }
            set { m_unitPrice = value; }
        }
        public decimal TotalAmount
        {
            get { return m_unitPrice * m_quantity; }
            set { m_totalPrice = value; }
        }
        public decimal Discount
        {
            get { return m_discount; }
            set { m_discount = value; }
        }
        public DateTime CreatenDate
        {
            get { return m_cretnDate; }
            set { m_cretnDate = value; }
        }
        public long CreatenBy
        {
            get { return m_cretnBy; }
            set { m_cretnBy = value; }
        }
        public DateTime ModificationDate
        {
            get { return m_modfctnDate; }
            set { m_modfctnDate = value; }
        }
        public long ModificationBy
        {
            get { return m_modfctnBy; }
            set { m_modfctnBy = value; }
        }
    }
}
